package j04liu;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

class Man{
    String name;
    int age;

    public Man(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Man{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
public class J5zidingyi {
    public static void main(String[] args) {
        List<Man> l1 = new LinkedList<>();
        Collections.addAll(
                l1,
                new Man("luxun",57),
                new Man("runtu",13),
                new Man("cha",2),
                new Man("amao",4)
        );
        l1.stream()
                .filter(man->man.age<18)
                .forEach(man-> System.out.println(man));
    }
}
